package com.pet.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pet.mapper.ItemMapper;
import com.pet.mapper.UserMapper;
import com.pet.pojo.Item;
import com.pet.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BuyServiceImpl implements BuyService{
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private ItemMapper itemMapper;
    @Override
    public User getUser(String userName) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username",userName);
        User user = userMapper.selectOne(queryWrapper);
        return user;
    }

    @Override
    public Item getItem(Integer itemId) {
        Item item = itemMapper.selectById(itemId);
        return item;
    }
}
